home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / sources.arc / DANG_SRC.LZH / T9.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-12  |  56.4 KB  |  1,735 lines

  1. char hitwall[] = "2 hitwa";  /* hit wall sound */
  2.  
  3. #define CH_A_TONE_L     0x00,   /* TONE PERIOD REGS. determines pitch*/  
  4. #define CH_A_TONE_H     0x01,   /* period = 125,000 / freq (Hz) */
  5. #define CH_B_TONE_L     0x02,   /* see page 76 Atari ST TOS */
  6. #define CH_B_TONE_H     0x03,
  7. #define CH_C_TONE_L     0x04,
  8. #define CH_C_TONE_H     0x05,
  9. #define NOISE_PERIOD    0x06,    /* LOW = Thin,static like HIGH = fast rushing (windlike) */
  10. #define ENAB_TONE_NOISE 0x07,    
  11. #define CH_A_VOL_AMP    0x08,
  12. #define CH_B_VOL_AMP    0x09,
  13. #define CH_C_VOL_AMP    0x0a,
  14. #define ENV_PERIOD_L    0x0b,    /* Higher period = more slowly VOL changes and TONES are bell like*/
  15. #define ENV_PERIOD_H    0x0c,    /* lower period  = VOL changes fast and TONES are very raspy! */
  16. #define WAVEFORM        0x0d,    
  17. #define PLACE           0x80,    /* For Ending, or loops */
  18. #define INTO            0x81,
  19. #define INCREMENT_BY
  20. #define UNTIL
  21.  
  22. /* GLOBAL SOUNDS FOR DOSOUND() */
  23.  
  24. static unsigned char wind_sound[]={
  25. CH_A_VOL_AMP     0x0b,
  26. CH_B_VOL_AMP     0x11,
  27. CH_C_VOL_AMP     0x03,
  28. CH_A_TONE_H      0x01,
  29. CH_A_TONE_L      0xff,
  30. CH_B_TONE_H      0xff,
  31. CH_B_TONE_L      0xff,
  32. NOISE_PERIOD     0xff,
  33. ENAB_TONE_NOISE  0x03,
  34. ENV_PERIOD_L     0x22,
  35. ENV_PERIOD_H     0xff,
  36. WAVEFORM         0x0e,                         
  37. PLACE 0x02,INTO 0x12, INCREMENT_BY 0x02, UNTIL 0x25};
  38.  
  39. static unsigned char quiet[] = {
  40. CH_A_VOL_AMP     0x00,
  41. CH_B_VOL_AMP     0x00,
  42. CH_C_VOL_AMP     0x00,
  43. CH_A_TONE_H      0x00,
  44. CH_A_TONE_L      0x00,
  45. CH_B_TONE_H      0x00,
  46. CH_B_TONE_L      0x00,
  47. NOISE_PERIOD     0x00,
  48. ENAB_TONE_NOISE  0x00,
  49. ENV_PERIOD_L     0xff,
  50. ENV_PERIOD_H     0xff,
  51. WAVEFORM         0x00,  
  52. 0xff,0x00};
  53.     
  54.  
  55. static unsigned char rain_sound[]={
  56. CH_A_VOL_AMP     0xff,
  57. CH_B_VOL_AMP     0xff,
  58. CH_C_VOL_AMP     0x03,
  59. CH_A_TONE_H      0xff,
  60. CH_A_TONE_L      0x00,
  61. CH_B_TONE_H      0xff,
  62. CH_B_TONE_L      0x00,
  63. CH_C_TONE_H      0x09,
  64. CH_C_TONE_L      0x00,
  65. NOISE_PERIOD     0xff,
  66. ENAB_TONE_NOISE  0x63,
  67. ENV_PERIOD_L     0x22,
  68. ENV_PERIOD_H     0x11,
  69. WAVEFORM         0x0d,                         
  70. PLACE 0x02,INTO 0x12, INCREMENT_BY 0x02, UNTIL 0x24};
  71.  
  72.  
  73. #define WEAPON -5
  74. #define ARMORY -6
  75. #define GUILD -4
  76. #define SUPPLY -10
  77. #define TOWER -8
  78. #define TAVERN -3
  79. #define ARENA -11
  80. #define DUNGEON -13
  81. #define PALACE -7
  82. #define TEMPLE -1
  83. #define INN -2
  84. #define GATE -9
  85. #define BANK -12
  86. #define DOOR -99
  87. #define WALL 0
  88. /*
  89.  Wednesday June 17,1992
  90.  
  91.  FINALLY !!!!!!!!!!!!!!!!
  92.  
  93.  At 3:09 pm listening to Concrete Blonde
  94.  I got it to work!
  95.  
  96. o  This program will load up 3 grafic screens.
  97.    One title, and 2 back screens. It sets the tempMFDB addr to the 
  98.    1st back screen and copies the top left rectangle to the title screen
  99.    then it sets the tempMFDB to the 2nd back screen and copies the
  100.    top left rectangle to the title! AWESOME..
  101.  
  102. o  It now loads up 5 back screens and works
  103.  
  104. o June 19 1991 12:23 am
  105.    It includes the screen fetching set up. One problem, in the 
  106.    set_up module. If I declare any more data past [2] then It will
  107.    NOT fetch the pix properly. VERY WEIRD!. Once I had it up to [3]
  108.    and it worked, i tried to goto [4] it didnt work, so i went back
  109.    to [3] and it STILL DIDNT WORK!! S T R A N G E!
  110.  
  111. o June 22. 12:52 pm. Fixed the above problem. The fucked up thing was
  112.   that in the room_rec[] declaration I allocated only 3 cells (eg:
  113.   room_rec[3]) and I was assigning to room_rec[4 thru 8] Which 
  114.   DIDNT EXIST! The compiler didnt catch the out of bounds error 
  115.   and It was totally screwing up the program in subtle ways.
  116.  
  117.   - Everything works, the lookup routines are up and running
  118.     
  119.   - 4:53 pm. Incorporated a mini city. All code is in place, and 
  120.     all bugs are fixed(I hope) the city is officially up and running
  121.     . You can walk around, etc. Too fucking cool. and 6 yrs in the
  122.      making...
  123.  
  124. o Implementing all modules, fight routines etc.
  125.  
  126. o July 1, Wednesday. Fight routines updated, only problem is I
  127.   need to check the logic in the fight, and Fix the cast() ROUTINE.
  128.   You now can ancounter 50 diff types of monsters/people
  129.  
  130. o Degas Elite with Uncompression added. Reduces much WASTED space
  131.   needed for 32k NEO pics
  132.  
  133. o Added new pixs, Temple etc. Will use its own pallette. Also implemneted
  134.   establishments. I.e walk into a temple now, or go into a shoppe
  135.  
  136. o 25 Aug. 1992 :College Station. Fixed the main palette because of multiple
  137.   same -colors, Also fixed 2nd pal. to work with first. Updated all 
  138.   DAT files. hint, use Degas Elites Remap fnct when changing colors
  139.   in the palettes much faster than doing it manually. Also updated 
  140.   main screen with 2 pillars with vines.
  141.  
  142. o 13 Feb.1993 Adding new city co-ords, for main city...most of the new
  143.   templates have been made.
  144.   All templates have been made. Tried to modify prg to work with 
  145.   19 of them .Took up too much memeory, so I'm down to 9 right now. 
  146.   The read map from a file module isnt working, checking on it.
  147.  
  148. o 4 March Could not fit all pics in memory at one time so i decided
  149.     to use Virtual memory, and swap screens in and out of memory as needed
  150.   Virtual memory implemented. 5 working background screens for city
  151.   template pics. File T3.C IS WORKING..  
  152.  
  153. o 5 March- The top 1/2 of the city works flawlessly!
  154.            Now creating bottom half.(adding to ROOM.DAT file)  
  155.  
  156. o 9 March- City is finally coded. Room.dat is completed. ALL city 
  157.            template pics are made (22 pics in all = 22*4 = 88 pics)
  158.            Checking the city to see if all is in order.
  159. o 8 April- Put SND player in as TSR. Fixed array error on monsters[]
  160.            i had 0-50 records but only allocated monsters[50] or 0-49
  161.            thats a no no!
  162.          - Street names are implemented, threw out idea to make it 
  163.            1/2 meg, too many restrictions, also increased physical 
  164.            screens to 10 templates.
  165. o 15 April- Hard drive crashed, new one just came in. 
  166.             - Real time is implemented
  167.             - 
  168. o 25 May  - Schools over, just got back from Stockholm,Sweden.
  169.             - Fixed minor things, made enhancements
  170.             - Added a 'pause' function, 'Help' function
  171. o 29 May  - -Added digitized sounds, gen_estab fixed and up and running
  172.              Weapons Shoppe works.
  173. o 30 May  - -Grabbed fantasy .gifs from the Internet and converted
  174.              them over to degas, very cool. 
  175.             -Can enter houses
  176.             -Everything is working, just some touch ups and 
  177.              minor adjustments.
  178. o 10 June - Fixed: too many 'encounters problem,cast exit problem and 
  179.                    cast problem,Monster talk,now harder to get a chest
  180. o 25 June - Killed the original Bards Tale city wall pics and made
  181.             my own. Looking to fix sky color problem and TSR bombing
  182.             due to the sound samples.
  183. o Month of July- Boy, I implemented alot of stuff. Backpack, user
  184.             item list. A gate that opens. etc.
  185. o 5 Aug  - after this I'm not going to doc any more additions
  186.            Scroller,Gauntlet,Estab pics inside, and animated
  187.            smithy.
  188. o 24 Aug - Implemented Double Buffering. Now all flicker is 
  189.            fixed. and we get smooth animation!
  190.            I'm going to fix all the pics and make them look nice!
  191.  
  192.     main() - This is the main function for the example VDI functions.
  193. */
  194. /*
  195.  
  196.    Screen area to put pic is divided into 6 regions
  197.  
  198.    +---+---+---+---+---+---+
  199.    |   |   |   |   |   |   |
  200.    |   |   |   |   |   |   |
  201.    |   |   |   |   |   |   |
  202.    |   |   |   |   |   |   |
  203.    |   |   |   |   |   |   |
  204.    |   |   |   |   |   |   |
  205.    +---+---+---+---+---+---+
  206.      1   2   3   4   5   6
  207.  
  208.  
  209.  o There are 9 templates. Divided into 3 Main categories.
  210.    
  211.    CLOSE,MID,FAR.
  212.  
  213.  o There are 3 sub categories. 
  214.   
  215.    Left Wall,Right Wall,Front Wall.
  216.  
  217.   
  218.    |\
  219.    | \
  220.    |  |    <--- this would be a CLOSE,LEFT WALL
  221.    | /
  222.    |/
  223.  
  224.    |\
  225.    | |     <--- This would be a MID,Left Wall
  226.    |/
  227.  
  228.    |\       <--- This is a FAR, Left Wall.
  229.    |/
  230.  
  231.    o The Right Wall is the same but flipped about the Y axis.
  232.  
  233.    o the Front Wall is:
  234.  
  235.      ___________
  236.     |           |
  237.     |           |   <-- This is a Close Front Wall.  etc..
  238.     |           |
  239.     -------------
  240.  
  241.  
  242.    THE LOGIC
  243.    ---------
  244.  
  245. o Each pic then has 6 fields, and each field can have one of 6
  246.   templates. If a field is 0 then it does not use any template.
  247.  
  248.   struct field_data
  249.    {
  250.     int Field1,
  251.         Field2,
  252.         Field3,
  253.         Field4,
  254.         Field5,
  255.         Field6;
  256.    };
  257.   struct pic
  258.    {
  259.     struct field_data N,S,E,W;
  260.    };
  261.  
  262.  o The map is made up of a 2d array of struct pic
  263.    
  264.     struct pic map[y][x];
  265.  
  266.  
  267.  o To build the map.
  268.    
  269.    1. Create your 2d map array by assigning the fields.
  270.    
  271.  o To create a picture.for room at  map[0][0] FACING North
  272.    
  273.    1. vrocopy the main template, which is a sky and ground, to the screen.
  274.    2. look at map[0][0].N.Field1 if !0 it tells which template to get.
  275.       vrocopy this to the correct xy loc on the screen.
  276.    3. Do # 2 for Fields 2-6.
  277.   
  278.  
  279. */
  280. /****************************************************************/
  281.  
  282.  
  283. /* defines for the 9 templates 
  284.    CL is Close Left Wall
  285.    CR is Close Right Wall
  286.    CF is close Front Wall
  287.    ML,MR,MF
  288.    FL,FR,FF
  289. */
  290.  
  291. #define CL 1
  292. #define CR 2
  293. #define CF 3
  294. #define ML 4
  295. #define MR 5
  296. #define MF 6
  297. #define FL 7
  298. #define FR 8
  299. #define FF 9
  300. #define EMPTY 0
  301.  
  302.  
  303.       /* uses ONLY fncts from there 'h' files*/
  304. #include <gemdefs.h>       /* that it needs. Smart compiler */
  305. #include <osbind.h>
  306. #include <stdio.h>
  307. #include <maindef2.h>
  308. #include <strings.h>
  309. #define pos_rnd(t) Random()%(t)   /*returns a number from 0 to (t-1) */
  310.  
  311. char *screen,*temp;    /* double buffering screens */
  312. int which_screen = 0;  /* if 0 then use 'screen'
  313.                           if 1 then use 'temp'
  314.                          For double buffering purposes. */
  315.  
  316.  int  buffer[200];        /* holds the char info for disk loading and saving */
  317.  
  318. main()
  319.  
  320. {
  321.     MFDB    theMFDB;    /*  Screen definition structure  */
  322.     MFDB    tempMFDB;
  323.    
  324.     char *scr1,*scr2,*scr3,*scr4,*scr5,*scr6;
  325.       /* used to be in main() now global */
  326.     int realtime=4;/* we'l do a realtime%4 */  
  327.     int off();
  328.     int pxyarray[8],enc_true;
  329.     long hold_addr;
  330.     int xs1,ys1,xs2,ys2,xd1,yd1,yd2,xd2;
  331.     int colors[2];       
  332.     int f,g;
  333.     char dis_map;
  334.     int savex,savey;
  335.    
  336.  
  337.     appl_init();
  338.     handle = open_workstation(&theMFDB);  /*set up screen MFDB */
  339.  
  340.   
  341.    temp = malloc(32768+256);  /*allocate memory for 2nd screen */
  342.     if ((long) temp & 0xff)
  343.       temp = temp + (0x100 - (long)temp & 0xff);
  344.       
  345.    scr1 = malloc(32768+256);  /*allocate memory for 2nd screen */
  346.     if ((long) scr1 & 0xff)
  347.       scr1 = scr1 + (0x100 - (long)scr1 & 0xff);
  348.       
  349.     scr2 = malloc(32768+256);  /*allocate memory for 2nd screen */
  350.     if ((long) scr2 & 0xff)
  351.       scr2 = scr2 + (0x100 - (long)scr2 & 0xff);
  352.   
  353.     scr3 = malloc(32768+256);  /*allocate memory for 2nd screen */
  354.     if ((long) scr3 & 0xff)
  355.       scr3 = scr3 + (0x100 - (long)scr3 & 0xff);
  356.     
  357.     scr4 = malloc(32768+256);  /*allocate memory for 2nd screen */
  358.     if ((long) scr4 & 0xff)
  359.       scr4 = scr4 + (0x100 - (long)scr4 & 0xff);
  360.   
  361.     scr5 = malloc(32768+256);  /*allocate memory for 2nd screen */
  362.     if ((long) scr5 & 0xff)
  363.       scr5 = scr5 + (0x100 - (long)scr5 & 0xff);
  364.  
  365.    scr6 = malloc(32768+256);  /*allocate memory for 2nd screen */
  366.     if ((long) scr6 & 0xff)
  367.       scr6 = scr6 + (0x100 - (long)scr6 & 0xff);
  368.     /* only 10 main physical screens in memory */
  369.  
  370. set_up1();             /* init rooms 1-100 */
  371. set_up2();             /* init rooms 101-247 */
  372. init();         /* init map etc.. */
  373.  
  374.     tempMFDB.fd_w    = theMFDB.fd_w ; /* 320 pixels wide*/
  375.     tempMFDB.fd_h       = theMFDB.fd_h ; /*200 pixels high */
  376.     tempMFDB.fd_wdwidth = theMFDB.fd_wdwidth ; /*16 words wide*/
  377.     tempMFDB.fd_stand = theMFDB.fd_stand ; /* raster coords.*/
  378.     tempMFDB.fd_nplanes = theMFDB.fd_nplanes; /*low rez has 4 planes */
  379.       
  380.  
  381. set_xy(xs1,ys1,xs2,ys2,xd1,yd1,xd2,yd2,pxyarray);
  382.  
  383.  
  384.  
  385.  read_stuff(pix1,scr1,1);         /* read back screen into memory */
  386.  read_stuff(pix2,scr2,1);         /* if 0 save to pal4(alt palette),*/
  387.                                   /* if 1 save to newpal(main palette)*/
  388.                                   /* pics that should have a 1 */
  389.                                   /* MISCX.DAT and monster pics */
  390.  read_stuff(pix3,scr3,1);         
  391.  read_stuff(pix4,scr4,1);
  392.  read_stuff(pix5,scr5,1);
  393.  read_stuff(pix6,scr6,1);       
  394.  
  395.  
  396.  
  397. /* find screen base */
  398. screen = (char *)Physbase(); 
  399. read_stuff(title,temp,1);  /* read main title screen onto the screen*/
  400. read_stuff(title,screen,1); /* read main title screen onto back screen also. */
  401. Setscreen(screen,screen,-1);
  402.  
  403. theMFDB.fd_addr = (long) screen;
  404.  
  405. Setpalette(newpal);        /* tel sys to use these colors! */
  406.  
  407. /*main loop */
  408.  start();
  409.  
  410. colors[0]=1;
  411. colors[1]=0;
  412.  
  413. events();
  414. if(weather ==4) Setcolor(6,CURRENT_CLOUD);
  415. else Setcolor(6,CURRENT_SKY);
  416.  
  417. display(&theMFDB,&tempMFDB,pxyarray,scr1,scr2,scr3,scr4,scr5,scr6);
  418. Vsync();
  419.  
  420.  
  421. double_buffer(&theMFDB,&tempMFDB,pxyarray);
  422.  
  423. display_user_stats();
  424.  
  425.  do
  426.      {
  427.    /* update location */
  428.    if( (x < 10 && savex == 10) || (x < 100 && savex == 100))
  429.    v_gtext(handle,133,94,"  ");
  430.    v_gtext(handle,122,94,"x:");
  431.    sprintf(string,"%d",x);
  432.    v_gtext(handle,133,94,string);
  433.  
  434.    if( (y < 10 && savey == 10) || (y < 100 && savey == 100))
  435.    v_gtext(handle,169,94,"  ");
  436.      v_gtext(handle,158,94,"y:");
  437.    sprintf(string,"%d",y);
  438.    v_gtext(handle,169,94,string);
  439.  
  440.    savex = x; savey = y;  /* save */
  441.  
  442.       while ( !Bconstat(2) )      /* while no input and didnt just have an encounter  */
  443.        {  
  444.         if( realtime%5 == 0 )    /* stagger */
  445.         {
  446.         switch(realtime%4)
  447.           {
  448.            case 0: v_gtext(handle,276,110,"<");  
  449.                    break;
  450.            case 1: v_gtext(handle,276,110,"=");  break;
  451.            case 2: v_gtext(handle,276,110,">");  break;
  452.            case 3: v_gtext(handle,276,110,"?"); 
  453.           }
  454.         }       
  455.        realtime++;
  456.        if ( realtime > 32767 ) realtime = 0;
  457.        enc_true = events();       /* returns 1 if encounter */
  458.       if (enc_true)
  459.         {
  460.        hold_addr = tempMFDB.fd_addr;  /* save current pic */
  461.        encounter(&tempMFDB,&theMFDB,pxyarray,scr6,&enc_true);
  462.         tempMFDB.fd_addr =(long) hold_addr;  /* restore pic */
  463.         Vsync(); 
  464.       if(weather == 4){
  465.                        Setcolor(6,CURRENT_CLOUD); Dosound( rain_sound );
  466.                       }
  467.  
  468.       else Setcolor(6,CURRENT_SKY);  /* redisplay sky */
  469.  
  470.         display(&theMFDB,&tempMFDB,pxyarray,scr1,scr2,scr3,scr4,scr5,scr6);
  471.         double_buffer(&theMFDB,&tempMFDB,pxyarray);
  472. if(weather !=4) Setcolor(6,CURRENT_SKY);  /* redisplay sky */
  473.  
  474.         v_gtext(handle,197,99,street_hold); /* restore street name you were on */
  475.         }
  476.       Vsync();                  /* to reduce flicker */  
  477.       v_gtext(handle,204,188,weather_list[weather]); 
  478.      
  479.        }
  480.  
  481.     
  482.     
  483.       command = Bconin(2);
  484.        if(command == 0x480000)  /* Foreward */
  485.             {
  486.              move(&tempMFDB,&theMFDB,pxyarray,scr1,scr2,scr3,scr4,scr5,scr6);
  487.            /*  tempMFDB.fd_addr = hold_addr;   restore pic */ 
  488.             /*Setpalette( newpal );*/
  489.              display(&theMFDB,&tempMFDB,pxyarray,scr1,scr2,scr3,scr4,scr5,scr6);
  490.              double_buffer(&theMFDB,&tempMFDB,pxyarray);
  491.             }
  492.        if(command == 0x4b0000)   /* left */
  493.             {
  494.              look();
  495.              display(&theMFDB,&tempMFDB,pxyarray,scr1,scr2,scr3,scr4,scr5,scr6);
  496.              double_buffer(&theMFDB,&tempMFDB,pxyarray);
  497.             }
  498.        if (command == 0x4d0000)   /*Right */
  499.             {
  500.              look();
  501.              display(&theMFDB,&tempMFDB,pxyarray,scr1,scr2,scr3,scr4,scr5,scr6);
  502.              double_buffer(&theMFDB,&tempMFDB,pxyarray);
  503.             }
  504.      
  505.         check_for_door();
  506.       
  507.        if (command == 0x190050 || command == 0x190070)/* P key to PAUSE */
  508.         {v_gtext(handle,40,76,"PAUSED");
  509.          user_pause();
  510.          v_gtext(handle,40,76,"      ");
  511.         }
  512.        if (command == 0x620000)       /* Help key for HELP! */
  513.         { help_user();
  514.           user_pause();
  515.         }
  516.         if (command == 0x170069 || command == 0x170049)       /*I key for special display..gold etc..*/
  517.         special_display();
  518.  
  519.        if (command == 0x3b0000 )  /* F1 for change weapon */
  520.          switch_weapon();
  521.        if(command == 0x220047 || command == 0x220067) /* G for game options */
  522.           game_options(temp,scr1,scr2,scr3,scr4,scr5,scr6);   /* save,quit,credits,sound on/off etc */ 
  523.        
  524.        if(command == 0x160075 || command == 0x160055)  /* U for user item list */
  525.          list_user_items();
  526.        if((command == 0x140054 || command == 0x140074) && user.user_items[13] == 1) 
  527.                                       /* if T pressed and you have a timepiece.. */
  528.          check_time();
  529.           display_user_stats();
  530.           display_street();
  531.      
  532.  
  533.  
  534.       hold_addr = tempMFDB.fd_addr;  /* save addr of source pix (pic w/ wall templates */         
  535.           special_events(&tempMFDB,&theMFDB,pxyarray,scr3);  /* special actions check */
  536.           /* scr3 holds addr of gate.pic */
  537.       tempMFDB.fd_addr =(long) hold_addr;  /* restore pic */
  538.       
  539.    }while (1);        /* 4-ever loop.... */
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.   
  549.  
  550. }
  551.  
  552. /* load degas compressed pics */
  553.  
  554. /************************/
  555. read_stuff(hold,adrr,which)
  556. char hold[];
  557. register char *adrr;
  558. int which;  
  559. /* if which = 1 then store palette into newpal*/
  560. /* which is the main pal of the game. If = neg then store */
  561. /* into pal 4. the alternate pals of the game */
  562.  
  563. {
  564.  char buf[130];
  565.  int lines,m;
  566.  static int only_once = 1;
  567.  
  568. filehandle = Fopen(hold,0); 
  569.  
  570. if( only_once )        /* save the palette ONCE!!! */
  571. {
  572. for(i=0; i<16;i++)
  573.  savepal[i]=Setcolor(i,-1);
  574. only_once = 0;
  575. }
  576.  
  577. /* read header data */
  578. i=Fread(filehandle,2L,buf);
  579.  
  580.  
  581. /* read 16 words of palette data into newpal array */
  582. if(which <= 0)
  583.  {
  584.  
  585.  if (which == 0)i = Fread(filehandle,32L,pal4);
  586.  }
  587. else
  588. i =Fread(filehandle,32L,newpal);
  589.  
  590.  
  591.  
  592.  
  593. i=Fread(filehandle,32000L,temp_);  /* read image onto back screen*/
  594. /* Close file */
  595. Fclose(filehandle);
  596.      lines = 200;                     /* Low, med-res    */
  597.                  iff_in  = temp_;                /* iff_in pts to temp_buf*/
  598.                  iff_out = adrr;      /* iff_out pts to pic_buffer*/
  599.                   do        
  600.          unpack(0);                                      /* Unpack a line at a time */
  601.                   while (--lines); 
  602.  
  603.  
  604.  /*v_gtext(handle,1,5,"             ");*/
  605.        
  606. }
  607. /************************/
  608.  
  609. /***********************/
  610.  
  611. /*---------------------------------------------------------------------------*/
  612. /*                             |--------- DEGAS ---------|            */
  613. /*                              UNCOMPRESSED   COMPRESSED            */
  614. /*                 NEO  low med mono   low med mono     TINY    */
  615. /*    typ...        0     1   2   3     4   5   6     7        */
  616.  
  617. /* Unpacks a single scan line & updates iff_in & iff_out global pointers
  618.  
  619.                      /    byt ==  0 to  127  copy next [byt+1] bytes
  620. Unpack routine --if-<    byt == -1 to -127  copy next byte [-byt+1] times
  621.                      \    byt == 128         NO-OP                            */
  622.  
  623. unpack(rez)
  624. int     rez;
  625.  
  626. {
  627.     register char     *src_ptr, *dst_ptr,           /* ptrs to source/dest */
  628.               byt, cnt;                     /* byt holds the ACTUAL compressed data code(control byte ) */
  629.     register int      minus128 = -128, 
  630.               len;                          
  631.     char                 linbuf[320];                            /* Oversize just in case! */
  632.     int                      llen;
  633.  
  634.  
  635.     if (rez < 2)     len = 160;
  636.     else             len = 80;
  637.     llen = len;
  638.     src_ptr = iff_in;           /* iff_in is ptr to compressed data */
  639.     dst_ptr = &linbuf[0];       /* linbuf WILL hold an ENTIRE Uncompressed scan line. 4 bitplanes * 80 = 320 max! */ 
  640.  
  641.     while (len > 0)
  642.    {
  643.             byt = *src_ptr++;       /* get byte value at address scr_ptr, THEN inc scr_ptr+1 */
  644.             if (byt >= 0)           /* If ctrl code >= 0 then use the next x+1 bytes*/
  645.     {
  646.                  ++byt;                 /* inc byt +1 */
  647.                   do 
  648.        {
  649.                         *dst_ptr++ = *src_ptr++;  /* get byte value from address source, and inc the 2 ptrs */
  650.                         --len;                    /* one byte down.. */
  651.                    }
  652.          while (--byt);           /* do this byt TIMES (remember byt here = byt+1 */
  653.              }
  654.              else 
  655.        if (byt != minus128)       /* else if ctrl code NOT = -128*/
  656.          {                        /*Then use the next byte -x+1 times, (-x) cause x will be negative and - - = + */
  657.                       cnt = -byt + 1;         /* cnt = -x + 1 */
  658.                       byt = *src_ptr++;       /* byt = THE very next byte past the ctrl code(or ctrl byte! */
  659.                        do {
  660.                                *dst_ptr++ = byt;  /* store that byte */
  661.                                --len;         
  662.                           }
  663.                while (--cnt);    /* keep doing it cnt times */
  664.                   }
  665.         }
  666.  
  667.     ilbm_st(linbuf, iff_out, rez);   /* convert the format line */
  668.     iff_in = src_ptr;                                    /* Update global pointers */
  669.     iff_out += llen;
  670.  
  671. }                                /* end of module uncompress() */
  672.  
  673. /*---------------------------------------------------------------------------*/
  674.  
  675. ilbm_st(src_ptr, dst_ptr, rez)           /* Convert ILBM format line to ST format */
  676. int         *src_ptr, *dst_ptr, rez;
  677. {
  678.     int         x, *p0_ptr, *p1_ptr, *p2_ptr, *p3_ptr;
  679.  
  680.     if (rez==0) 
  681.  {                                                     /* Low-res */
  682.   
  683.         p0_ptr = src_ptr;
  684.         p1_ptr = src_ptr + 20;
  685.         p2_ptr = src_ptr + 40;
  686.         p3_ptr = src_ptr + 60;
  687.         for (x=0; x<20; ++x)
  688.   {
  689.                *dst_ptr++ = *p0_ptr++;
  690.                *dst_ptr++ = *p1_ptr++;
  691.                *dst_ptr++ = *p2_ptr++;
  692.                *dst_ptr++ = *p3_ptr++;
  693.           }
  694.     } 
  695.  else if (rez==1) 
  696.   {                                            /* Med-res */
  697.            p0_ptr = src_ptr;
  698.            p1_ptr = src_ptr + 40;
  699.            for (x=0; x<40; ++x)
  700.     {
  701.                  *dst_ptr++ = *p0_ptr++;
  702.                  *dst_ptr++ = *p1_ptr++;
  703.             }
  704.     }
  705.     else 
  706.      {                                                   /* Monochrome */
  707.               for (x=0; x<40; ++x)
  708.                   *dst_ptr++ = *src_ptr++;
  709.          }
  710.  
  711.  }
  712. /*---------------------------------------------------------------------------*/
  713.  
  714.  
  715. /***********************/
  716.  
  717. set_xy(xs1,ys1,xs2,ys2,xd1,yd1,xd2,yd2,pxyarray,tmp_array)
  718.  int xs1,ys1,xs2,ys2,xd1,yd1,yd2,xd2;
  719.  int pxyarray[8];
  720.  int tmp_array[8];
  721. {
  722.  
  723.     /**********************/
  724.   /* source is the tempMFDB and dest is the theMFDB */
  725.  /* xs1 ys1 and xs2 ys2 are DIAGONALLY OPPOSITE CORNERS!! */
  726.   xs1=  70;
  727.   ys1=  93;
  728.   xs2=  192;
  729.   ys2=  181;
  730.  
  731.   xd1=194;
  732.   yd1=3;
  733.   xd2=316;
  734.   yd2=91;
  735.  
  736.   pxyarray[0] = xs1;
  737.   pxyarray[1] = ys1;
  738.   pxyarray[2] = xs2;
  739.   pxyarray[3] = ys2;
  740.   
  741. hold_xy[0] =  xd1;
  742. hold_xy[1] =  yd1;
  743. hold_xy[2] =  xd2;
  744. hold_xy[3] =  yd2;
  745. hold_xy[4] =  pxyarray[4] = xd1;
  746. hold_xy[5] =   pxyarray[5] = yd1;
  747. hold_xy[6] =   pxyarray[6] = xd2;
  748. hold_xy[7] =  pxyarray[7] = yd2;
  749.  
  750.  
  751.  
  752. /**************************/
  753. }
  754.  
  755. /*************************************************************/
  756. /*  This function    - creates the map to move around in
  757.                      - reads map data from file ROOM.DAT
  758.                      - sets your starting position 
  759.  
  760.                        0 - Cant move that way (Wall)
  761.                    pos # - Room you'll goto 
  762.                    neg # - Loads up an establishment 
  763.                     -1 temple
  764.                     -2 inn
  765.                     -3 tavern
  766.                     -4 guild
  767.                     -5 weapon
  768.                     -6 armor
  769.                     -7 castle
  770.                     -8 tower
  771.                     -9 outside, exit city          
  772.                     -999 enter a house(knock down door)     */
  773.  
  774.  init()
  775.  
  776.   
  777. {
  778.     char in;
  779.    FILE *ifp;
  780.    char array[5];         /* at most a max of 3 numbers xxx+null */
  781.    int number;            /* stores converted number */
  782.    int xo=0,yo=0;
  783.    int type=0;            /* if =0 store room
  784.                                  1        n
  785.                                  2        s
  786.                                  3        e
  787.                                  4        w */
  788.  
  789.  
  790.  
  791.    
  792.    ifp = fopen("ROOM.DAT","r");        /* r means read only mode */
  793.     if( ifp == NULL) {printf("Error opening room.dat--\n"); exit(1);}
  794.      while( (fgets(array,5,ifp) !=NULL))
  795.       {                /* number read is placed in array . terminated w/  /0 */
  796.          number = atoi(array);      /* converts string to int */
  797.         /* printf("number read:%d\n",number);*/
  798.          if(type ==0)
  799.           {
  800.           map[yo][xo].room = number;    /* store it */
  801.          /* printf("storing room #:%d\n",map[yo][xo]);*/
  802.           }
  803.   
  804.           if(type==1)
  805.             {
  806.              map[yo][xo].n = number;    /* store it */
  807.            /*  printf("storing nort:%d\n",map[yo][xo].n);*/           
  808.             }
  809.         if(type==2)
  810.             {
  811.              map[yo][xo].s = number;    /* store it */
  812.              /*printf("storing south:%d\n",map[yo][xo].s);   */        
  813.             }
  814.            if(type==3)
  815.            {
  816.            map[yo][xo].e = number;    /* store it */
  817.            /* printf("storing east:%d\n",map[yo][xo].e); */          
  818.             }
  819.          if(type==4)
  820.          {
  821.                map[yo][xo].w = number;    /* store it */
  822.           /* printf("storing west:%d\n",map[yo][xo].w); */           
  823.             }
  824.  
  825.  
  826.          type++;
  827.          if( type > 4)
  828.            {
  829.             /* printf("#,and dirs done for room\n");*/
  830.              type = 0;     /* if > 4, reset */
  831.              xo++;                /* we will assign in row major*/
  832.            }
  833.           if( xo == 25)           /* if did all horiz. rooms */
  834.           {
  835.             xo = 0;              /* reset x */
  836.             yo++;                /* and increase y */  
  837.           }
  838.        }       /* end of while */
  839.  
  840.    fclose(ifp);
  841.  
  842.   
  843.    flags.which_pal = 0;   /* start w/ main palette */
  844.   
  845. }
  846.    
  847.  
  848. /*******************/
  849.  
  850.   look()
  851.    
  852.   
  853.  
  854.  {
  855.    int ret;
  856.     /*v_gtext(handle,1,36,"in look");*/
  857.     
  858.  
  859.    switch(dir)
  860.     {
  861.      case 'N' : {
  862.                   if(command == 0x4b0000)
  863.                   dir = 'W';
  864.                   if(command == 0x4d0000)
  865.                   dir = 'E';
  866.                   break;
  867.                 }   
  868.  
  869.      case 'S' : {
  870.                   if(command == 0x4b0000)
  871.                   dir = 'E';
  872.                   if(command == 0x4d0000)
  873.                   dir = 'W';
  874.                   break;
  875.                 }   
  876.      case 'E' : {
  877.                   if(command == 0x4b0000)
  878.                   dir = 'N';
  879.                   if(command == 0x4d0000)
  880.                   dir = 'S';
  881.                   break;
  882.                 }      
  883.      case 'W' : {
  884.                   if(command == 0x4b0000)
  885.                   dir = 'S';
  886.                   if(command == 0x4d0000)
  887.                   dir = 'N';
  888.                   break;
  889.                 }
  890.             }  /*end of case*/
  891.       /*v_gtext(handle,1,36,"         ");*/
  892.  
  893.     } /*end of funct*/
  894.  
  895.  
  896.  
  897.  
  898.  
  899. /**************************************************************/
  900. /* This function will :
  901.  
  902.                  - Check to see if you move is valid
  903.                  - If so it will move you in the dir 
  904.                    you are facing and adjust your new
  905.                    position accordingly                    
  906.                  - load up estabs.pic if needed. and change 
  907.                    the palette, it will save the 3 changed colors
  908.                    in col1,col2,col3 and replace them at end of this
  909.                    module
  910. */
  911. move(mf_src,mf_dest,pxyarray,scr1,scr2,scr3,scr4,scr5,scr6)
  912. register MFDB *mf_src,*mf_dest;   /* the src and dest MFDBs!! */
  913. char *scr1,*scr2,*scr3,*scr4,*scr5,*scr6;
  914. int pxyarray[8];
  915.   
  916.    {
  917.     int temp_value,m,col1=0; 
  918.     int blocked = 0;
  919.                                      /* clear our 'door is near' mssg */
  920.         v_gtext(handle,6,83,"                      ");
  921.  
  922.       switch(dir)
  923.      {
  924.      case 'N': {
  925.                 temp_value = map[y][x].n;  /* get it to test for - */ 
  926.                 if(map[y][x].n == 0)
  927.                 blocked = 1;
  928.                   if(map[y][x].n > 0)
  929.                    y = y - 1;
  930.                   break;
  931.                }
  932.      case 'S': {
  933.                 temp_value = map[y][x].s;
  934.                 if(map[y][x].s == 0)
  935.                 blocked = 1;
  936.                  if(map[y][x].s > 0) 
  937.                   y = y + 1;
  938.                   break;
  939.                }
  940.      case 'E': {
  941.                 temp_value = map[y][x].e;
  942.                 if(map[y][x].e == 0)
  943.                 blocked = 1;
  944.                 if(map[y][x].e > 0)
  945.                   x = x + 1;
  946.                   break;
  947.                }
  948.      case 'W': {
  949.                 temp_value = map[y][x].w;
  950.                 if(map[y][x].w == 0) blocked = 1;
  951.                  if(map[y][x].w > 0)
  952.                    x = x - 1;
  953.                   break;
  954.                } 
  955.        } /*end of switch*/
  956.   if(blocked)
  957.    {
  958.      v_gtext(handle,44,65,"Blocked!        ");
  959.      invoke_tsr( hitwall );
  960.       if(CURRENT_SOUND == 1) Dosound( wind_sound );
  961.       if(CURRENT_SOUND == 4) Dosound( rain_sound );
  962.    }  
  963.  
  964.  /* check for negative . If so, DONT change the x,y coords, but 
  965.     execute establishment code */
  966.    /* lets re set up pxyarray, cause new pic code may have reset it */
  967.     pxyarray[4] = 194; /* just reset the x1 and x2 values */
  968.     pxyarray[6] = 316;
  969.  
  970.     if (temp_value < 0)
  971.      { 
  972.        if(temp_value == -2 || temp_value == -3 || temp_value == -10 || temp_value == -12)
  973.        {col1=1;
  974.        load_up_inside_pics(mf_src,mf_dest,pxyarray,scr2,1); /* send it addr of estab.dat in scr2 */
  975.        }
  976.        /* will load up pic for, inn,tavern,supply & bank. Will change 
  977.           3 color palette cells to a diff color, col1 is set to 1 denoting a palette color has changed! 
  978.           LOOK at the last parameter in the function call. If 1 then use reg. inside pic, else
  979.           use smithy pic. */
  980.        if(temp_value == -4) /* guild pic */
  981.        {col1 = 1;
  982.         load_up_inside_pics(mf_src,mf_dest,pxyarray,scr2,2);
  983.        }
  984.        if(temp_value == -5 || temp_value == -6  )
  985.        { col1 = 1;
  986.         
  987.        load_up_inside_pics(mf_src,mf_dest,pxyarray,scr2,0);
  988.        }
  989.        /* will load up pic for, armory,weaponry,guild Will change 
  990.           3 color palette cells to a diff color, and change em back upon exit */
  991.       
  992.  
  993.  
  994.          switch(temp_value)
  995.          {
  996.            case -1: temple(mf_src,mf_dest,pxyarray,scr6);
  997.                     break;
  998.            case -2: inn();
  999.                     break;
  1000.            case -3: 
  1001.                     tavern();
  1002.                     break;
  1003.            case -4: guild();
  1004.                     break;
  1005.            case -5: weapon(); /* ok. if we enter an estab, the pic ESTABS.DAT has just been
  1006.                                  loaded. So all we need to send is MFDB source and dest.!*/
  1007.                    gen_estab(mf_src,mf_dest,"weapons.dat","Dragons Head Weaponry",0);
  1008.                    break;
  1009.            case -6:armour();
  1010.                    gen_estab(mf_src,mf_dest,"armor.dat","Platinum Armory",1);   /* send it 1 to denote armory */
  1011.                    break;
  1012.            case -7: castle(mf_src,mf_dest,pxyarray,scr5);
  1013.                     break;
  1014.            case -8: tower(mf_src,mf_dest,pxyarray,scr6,scr4);
  1015.                     break;
  1016.            case -9: outside();
  1017.                     break;
  1018.            case -10:supply();
  1019.                     gen_estab(mf_src,mf_dest,"supply.dat","Na chts Supply",2);   /* send it 2 to denote shoppe */
  1020.                     break;
  1021.            case -11:arena(mf_src,mf_dest,pxyarray,scr3,scr6);
  1022.                     break;
  1023.            case -12:bank();
  1024.                     break; 
  1025.            case -99: enter_room(mf_src,mf_dest,pxyarray,scr6);
  1026.                       break;
  1027.            case -13:dungeon(); break;
  1028.            }
  1029.               v_gtext(handle,197,99,street_hold); /* redisplay street name*/
  1030.         check_for_sound_change();
  1031.  
  1032.         if(col1 ==1 ) /* then we changed the current palette, so reset the colors... */
  1033.         { Setcolor(10,0x330); Setcolor(11,0x332); Setcolor(14,0x600);
  1034.         }
  1035. Setcolor(6,CURRENT_SKY);
  1036. if(weather == 4){
  1037.                  Setcolor(6,CURRENT_CLOUD);}
  1038.  
  1039.      
  1040.  
  1041. if(temp_value == TOWER)
  1042. {
  1043. /*Setpalette( newpal );*/
  1044. display(mf_dest,mf_src,pxyarray,*scr1,*scr2,*scr3,*scr4,*scr5,*scr6);
  1045. Setcolor(6,CURRENT_SKY);
  1046. if(weather == 4) Setcolor(6,CURRENT_CLOUD);
  1047. }
  1048.  
  1049.   } /* END OF TEMP VAL < 0*/
  1050.     } /*end of funct*/
  1051.  
  1052.  
  1053.  
  1054.  
  1055. /*******************************************/
  1056. /**************************************************************/
  1057.  
  1058. clean()
  1059.   
  1060.    {
  1061.       loc = map[y][x].room;
  1062.    }
  1063.  
  1064.  
  1065. /*******************/
  1066.  
  1067. /**************************************************************/
  1068.  
  1069.  
  1070. /* This funct :   - sets up a new font
  1071.                   - inits the hit roll table
  1072.                   - inits the AES and Aline
  1073.                   - inits the char stats 
  1074.                   - inits the virtual memory hit_table so first 
  1075.                     5 cells are set to 1, all others are 0 
  1076.                   - turns off keyclick so Dosound() will not be 
  1077.                     interrupted */
  1078. start()
  1079.  
  1080. {
  1081.     int color,catch;
  1082.     int off();
  1083.     int cellh,cellw,charh,charw;
  1084.     int number1 = 19,pp;
  1085.     char disk;
  1086.       
  1087.  
  1088.  
  1089.  /* hit roll table goes here */      /* the HRT...hmm put it in init! */
  1090.  for(pp=0;pp<16;pp++)
  1091.   {
  1092.     hrt[pp] = number1;
  1093.     number1--;
  1094.   }
  1095.  
  1096.  
  1097.  mhrt[0]=20;    /* users ac will go from 0-15 w/ 0 being lowest! */
  1098.  mhrt[1]=20;
  1099.  mhrt[2]=20;
  1100.  mhrt[3]=20;
  1101.  mhrt[4]=20;
  1102.  mhrt[5]=20;
  1103.  mhrt[6]=19;
  1104.  mhrt[7]=18;
  1105.  mhrt[8]=17;
  1106.  mhrt[9]=16;
  1107.  mhrt[10]=15;
  1108.  mhrt[11]=14;
  1109.  mhrt[12]=13;
  1110.  mhrt[13]=12;
  1111.  mhrt[14]=11;
  1112.  mhrt[15]=10;
  1113.  
  1114.  
  1115.     color = 7;                   /*set text color */
  1116.     vst_color(handle,color);
  1117.  
  1118.    runner=1;      
  1119.    mon_alive =1;
  1120.    char_alive =1;  /* if either is set to 0, encounter ends */
  1121.    
  1122.    loadchar(buffer);
  1123.    dir = user.dir;   /* set the map coords to place where you saved*/
  1124.    x   = user.x_loc;
  1125.    y   = user.y_loc;
  1126.   
  1127. /*
  1128. for(pp=0;pp<10;pp++)
  1129.  user.backpack[pp]=-1;*/       /* initally set backpack empty */
  1130. for(pp=0;pp<max_items;pp++)  /* set up weapon damnage point lookup */
  1131.  unique_item[pp].points = pp;
  1132.  
  1133. strcpy(unique_item[0].name,"Dagger");
  1134. strcpy(unique_item[1].name,"Club");
  1135. strcpy(unique_item[2].name,"Staff");
  1136. strcpy(unique_item[3].name,"War Hammer");
  1137. strcpy(unique_item[4].name,"Short Sword");
  1138. strcpy(unique_item[5].name,"Short Bow");
  1139. strcpy(unique_item[6].name,"Pole Arm");
  1140. strcpy(unique_item[7].name,"Halaberd");
  1141. strcpy(unique_item[8].name,"Long Bow");
  1142. strcpy(unique_item[9].name,"Long Sword");
  1143. strcpy(unique_item[10].name,"Battle Axe");
  1144. strcpy(unique_item[11].name,"Bastard Sword");
  1145. strcpy(unique_item[12].name,"Magical Staff");
  1146. strcpy(unique_item[13].name,"Magical Bow");
  1147. strcpy(unique_item[14].name,"Mithril Sword");
  1148. strcpy(unique_item[15].name,"Aurraks Staff");
  1149. strcpy(unique_item[16].name,"Conir Balde");
  1150. /* up to 50 of em , if want to make bigger, change size in maindefs.h */
  1151.  
  1152.  
  1153. /* set up street names, intersections */
  1154.  
  1155. intersection[0].room = 1;
  1156. strcpy(intersection[0].street_name," Herald Street");
  1157. intersection[1].room = 6;
  1158. strcpy(intersection[1].street_name," Herald Street");
  1159. intersection[2].room = 9;
  1160. strcpy(intersection[2].street_name," Herald Street");
  1161. intersection[3].room = 12;
  1162. strcpy(intersection[3].street_name," Herald Street");
  1163. intersection[4].room = 15;
  1164. strcpy(intersection[4].street_name," Herald Street");
  1165. intersection[5].room = 17;
  1166. strcpy(intersection[5].street_name," Herald Street");
  1167. intersection[6].room = 25;
  1168. strcpy(intersection[6].street_name," Herald Street");
  1169.  
  1170. intersection[7].room = 19;
  1171. strcpy(intersection[7].street_name,"  an alcove   ");
  1172.  
  1173. intersection[8].room = 18;
  1174. strcpy(intersection[8].street_name," a side street");
  1175. intersection[9].room = 49;
  1176. strcpy(intersection[9].street_name," a side street");
  1177. intersection[10].room = 164;
  1178. strcpy(intersection[10].street_name," a side street");
  1179. intersection[11].room = 216;
  1180. strcpy(intersection[11].street_name," a side street");
  1181.  
  1182. intersection[12].room = 69;
  1183. strcpy(intersection[12].street_name," Oldham Street");
  1184. intersection[13].room = 155;
  1185. strcpy(intersection[13].street_name," Oldham Street");
  1186. intersection[14].room = 198;
  1187. strcpy(intersection[14].street_name," Oldham Street");
  1188. intersection[15].room = 222;
  1189. strcpy(intersection[15].street_name," Oldham Street");
  1190.  
  1191. intersection[16].room = 163;
  1192. strcpy(intersection[16].street_name,"secret passage");
  1193.  
  1194. intersection[17].room = 220;
  1195. strcpy(intersection[17].street_name," Valkerye Way ");
  1196. intersection[18].room = 235;
  1197. strcpy(intersection[18].street_name," Valkerye Way ");
  1198. intersection[19].room = 207;
  1199. strcpy(intersection[19].street_name," Valkerye Way ");
  1200. intersection[20].room = 195;
  1201. strcpy(intersection[20].street_name," Valkerye Way ");
  1202.  
  1203. intersection[21].room = 37;
  1204. strcpy(intersection[21].street_name,"   a street   ");
  1205. intersection[22].room = 21;
  1206. strcpy(intersection[22].street_name,"   a street   ");
  1207. intersection[23].room = 22;
  1208. strcpy(intersection[23].street_name,"   a street   ");
  1209. intersection[24].room = 72;
  1210. strcpy(intersection[24].street_name,"   a street   ");
  1211. intersection[25].room = 44;
  1212. strcpy(intersection[25].street_name,"   a street   ");
  1213.  
  1214. intersection[26].room = 82;
  1215. strcpy(intersection[26].street_name,"  Gran Platz  ");
  1216. intersection[27].room = 128;
  1217. strcpy(intersection[27].street_name,"  Gran Platz  ");
  1218. intersection[28].room = 149;
  1219. strcpy(intersection[28].street_name,"  Gran Platz  ");
  1220.  
  1221. intersection[29].room = 144;
  1222. strcpy(intersection[29].street_name,"  Chariot Way ");
  1223. intersection[30].room = 156;
  1224. strcpy(intersection[30].street_name,"  Chariot Way ");
  1225. intersection[31].room = 199;
  1226. strcpy(intersection[31].street_name,"  Chariot Way ");
  1227. intersection[32].room = 194;
  1228. strcpy(intersection[32].street_name,"  Chariot Way ");
  1229.  
  1230. intersection[33].room = 190;
  1231. strcpy(intersection[33].street_name,"   an alley   ");
  1232. intersection[34].room = 161;
  1233. strcpy(intersection[34].street_name,"   an alley   ");
  1234.  
  1235. /*kill key repeat */
  1236. Kbrate(255,255);  
  1237.  
  1238. /* turn off keyclick*/ 
  1239.  
  1240. Supexec( off );
  1241.  
  1242. /* load font, font must be in INtel format!!!! */
  1243. v_gtext(handle,6,11,"Do you want to use the");
  1244. v_gtext(handle,6,19,"(C)urrent font or the");
  1245. v_gtext(handle,6,27,"(G)ame's font?");
  1246. do
  1247. {
  1248. disk = Bconin(2);
  1249. }while(disk != 'G' && disk != 'g' && disk != 'C' && disk != 'c');
  1250.  
  1251. if(disk == 'G' || disk == 'g')
  1252. {
  1253. vst_load_fonts(handle,0);  /*always 0 */
  1254. vst_font(handle,50);   /*id of goth_i8.fnt is 50 */
  1255. }
  1256.  
  1257. /* call funct to load PLAYER as a TSR*/
  1258. load_player_as_tsr();     /* will load player (ie.play.prg) as tsr */
  1259.  
  1260.  
  1261. assign_monsters(); /* assign the monsters!! */
  1262.  
  1263.  
  1264. do
  1265. {
  1266. if( (catch=Fopen("appla",0)) < 0 )
  1267.   {
  1268.       v_gtext(handle,6,11,"Please insert Disk 2  ");
  1269.       v_gtext(handle,6,19,"into the current drive");
  1270.       v_gtext(handle,6,27,"and press any key.");
  1271.       disk = Bconin(2);
  1272.        clear_it();
  1273.   }
  1274.     Fclose(catch);
  1275. } while(catch < 0 );
  1276.  
  1277.  
  1278. /* finally, lets display the constant stuff... */
  1279.  v_gtext(handle,24,104,"Name :");
  1280.  v_gtext(handle,24,112,"Align:");
  1281.  v_gtext(handle,24,120,"Class:");
  1282.  v_gtext(handle,24,128,"A.C. :");
  1283.  v_gtext(handle,24,136,"Lvl. :");
  1284.  v_gtext(handle,24,174,"Weapon:");
  1285.  v_gtext(handle,24,184,"Armour:"); 
  1286.  v_gtext(handle,24,196,"Location:");
  1287.  v_gtext(handle,96,196,"The City    ");
  1288.  v_gtext(handle,78,174,user.weapon);   
  1289.  v_gtext(handle,79,184,user.armor);
  1290.  v_gtext(handle,24,144,"STR. :");
  1291.  v_gtext(handle,24,152,"INT. :");
  1292.  v_gtext(handle,24,160,"DEX. :");
  1293.  v_gtext(handle,204,110,"Realtime:");
  1294.  v_gtext(handle,204,156,"S.P.:");
  1295.  v_gtext(handle,204,148,"H.P.:");   
  1296.  v_gtext(handle,204,180,"Weather");
  1297. }
  1298.  
  1299.  
  1300. /******************************************/
  1301. /* will display the street you are on 
  1302.    searches the intersection[max].room array for the room you are currently in
  1303.    if found then display new street
  1304.   
  1305.    room currntly in : = map[y][x].room;
  1306.    max == 35*/
  1307.  
  1308. display_street()
  1309. {
  1310.  int cell,max,counter;
  1311.  int not_found=1;        /* initally set to 1 */
  1312.  
  1313.    cell = map[y][x].room;
  1314.     max = 35;                  /* max search limit */
  1315.      counter = 0;
  1316.  
  1317.      while( (counter < max) && (not_found)) /* loop until found or search entire array */
  1318.        {
  1319.         if (cell == intersection[counter].room)
  1320.            { not_found = 0;    /* set to false, we found it */
  1321.              v_gtext(handle,197,99,intersection[counter].street_name); 
  1322.              strcpy(street_hold,intersection[counter].street_name);
  1323.             /* save the street name */
  1324.              
  1325.            }
  1326.         counter++;
  1327.        }
  1328. }
  1329.  
  1330. /**********/
  1331. off()
  1332. {
  1333.  char *conterm;
  1334.  
  1335.  conterm = (char *) 0x484L;
  1336.  *conterm &=0xFE;   /* turn lsb off */
  1337. }
  1338.  
  1339. /***********/
  1340. /* help user: Displays help info to the user */
  1341. help_user()
  1342. {
  1343.   
  1344. clear_it();
  1345. v_gtext(handle,6,11,"    ~ Help Options ~ ");
  1346. v_gtext(handle,6,27,"Up    Arrow -Go forward");
  1347. v_gtext(handle,6,35,"Right Arrow -Turn right");
  1348. v_gtext(handle,6,43,"Left  Arrow -Turn left");
  1349. v_gtext(handle,6,51,"P     Key   -Pause    ");
  1350. v_gtext(handle,6,59,"I     Key   -User Info");
  1351. v_gtext(handle,6,85,"Press any key");
  1352. user_pause();
  1353. clear_it();
  1354. v_gtext(handle,6,19,"    ~ Help Options ~ ");
  1355. v_gtext(handle,6,35,"F1   Key -Switch Weapon");
  1356. v_gtext(handle,6,43,"G    Key -Game Options");
  1357. v_gtext(handle,6,51,"U    Key -User Items");
  1358. v_gtext(handle,6,59,"T    Key -Check time");
  1359. v_gtext(handle,6,67,"Help Key -This Menu");
  1360. v_gtext(handle,6,75,"Undo Key -Quit game");
  1361. v_gtext(handle,6,83,"Press any key");
  1362.  
  1363. }
  1364.  
  1365. /*********/
  1366. /* user_pause: Waits until user hits a key before returning.. */
  1367.  
  1368. user_pause()
  1369. {
  1370.  char hh;
  1371.  
  1372.   hh = Bconin(2);
  1373. }
  1374.  
  1375.  
  1376. /************
  1377. Double_Buffer
  1378. *************/
  1379.  
  1380. double_buffer(theMFDB,tempMFDB,pxyarray)
  1381. register MFDB *theMFDB,*tempMFDB;
  1382. int pxyarray[8];
  1383. {
  1384.         
  1385. }
  1386.  
  1387. /*****************/
  1388. /* new pic code */
  1389. /*****************************/
  1390.  getcoord(Field ,pxyarray)     /* returns source pxyarray 
  1391.                        */
  1392.  int Field,pxyarray[8];
  1393.  
  1394.  /*#define CL 1
  1395. #define CR 2
  1396. #define CF 3
  1397. #define ML 4
  1398. #define MR 5
  1399. #define MF 6
  1400. #define FL 7
  1401. #define FR 8
  1402. #define FF 9
  1403. #define EMPTY 0 */
  1404.  
  1405. {char ccc;
  1406.  
  1407.   switch(Field)
  1408.     {
  1409.      case CL: pxyarray[0] = 131; pxyarray[1] = 3; pxyarray[2] = 150; pxyarray[3] = 91; break;
  1410.      case ML: pxyarray[0] = 151; pxyarray[1] = 3; pxyarray[2] = 170; pxyarray[3] = 91; break;
  1411.      case FL: pxyarray[0] = 171; pxyarray[1] = 3; pxyarray[2] = 192; pxyarray[3] = 91; break;
  1412.      case CF: pxyarray[0] = 71; pxyarray[1] = 3; pxyarray[2] = 90; pxyarray[3] = 91; break;
  1413.      case MF: pxyarray[0] = 91; pxyarray[1] = 3; pxyarray[2] = 110; pxyarray[3] = 91; break;
  1414.      case FF: pxyarray[0] = 111; pxyarray[1] = 3; pxyarray[2] = 129; pxyarray[3] = 91; break;
  1415.      case CR: pxyarray[0] = 171; pxyarray[1] = 93; pxyarray[2] = 192; pxyarray[3] = 181; break;
  1416.      case MR: pxyarray[0] = 151; pxyarray[1] = 93; pxyarray[2] = 170; pxyarray[3] = 181; break;
  1417.      case FR: pxyarray[0] = 131; pxyarray[1] = 93; pxyarray[2] = 150; pxyarray[3] = 181; break;
  1418.      case EMPTY: break;
  1419.     }
  1420.  
  1421. }
  1422. /*****************************/
  1423.  
  1424. display(mfd,mfs,pxyarray,scr1,scr2,scr3,scr4,scr5,scr6)
  1425. register MFDB *mfd,*mfs;
  1426. int pxyarray[8];
  1427. char *scr1,*scr2,*scr3,*scr4,*scr5,*scr6;
  1428.  
  1429. {
  1430. int check_for_new_pal,
  1431.     facing = 0;
  1432. char tyee;
  1433.  
  1434.            /* if facing an estab, facing will be a neg # */
  1435.            /* if -99 then its a door */
  1436.     if( dir == 'N') facing = map[y][x].n;
  1437.     if( dir == 'S') facing = map[y][x].s;
  1438.     if( dir == 'E') facing = map[y][x].e;
  1439.     if( dir == 'W') facing = map[y][x].w;
  1440.  
  1441.     cell = map[y][x].room;
  1442.       /* set dest as entire window */  /* recopy main template */
  1443.     pxyarray[4] = 194; pxyarray[5] = 3; pxyarray[6] = 316; pxyarray[7] = 91;
  1444.     mfs->fd_addr = (long) scr1;      /* set addr */
  1445.     pxyarray[0] = 194; pxyarray[1] = 93;  /* BR ground and sky only */
  1446.     pxyarray[2] = 316; pxyarray[3] = 181;
  1447.     vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy  */
  1448.    
  1449.      
  1450.     if(facing <= 0)          /* if your're facing an estab.. */
  1451.       {   
  1452.           switch(facing)
  1453.           {
  1454.            case BANK:
  1455.            case WEAPON:
  1456.            case ARMORY:
  1457.            case GUILD:
  1458.            case SUPPLY:
  1459.            case TAVERN:
  1460.            case INN:   mfs->fd_addr = (long) scr5; /* misc2.dat */
  1461.                        pxyarray[0] = 194; pxyarray[1] = 3; pxyarray[2]=316; pxyarray[3]=91; /* TR pic */
  1462.                        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy */
  1463.                        break;
  1464.            case TOWER: mfs->fd_addr = (long) scr5; /* misc2.dat */
  1465.                        pxyarray[0] = 70; pxyarray[1] = 3; pxyarray[2]=192; pxyarray[3]=91; /* TL pic */
  1466.                        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy */
  1467.                        break;
  1468.            case GATE:
  1469.            case ARENA: mfs->fd_addr = (long) scr1; /* main.pc1 TR has gate down pic*/
  1470.                        pxyarray[0] = 194; pxyarray[1] = 3; pxyarray[2]=316; pxyarray[3]=91; /* TR pic */
  1471.                        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy */
  1472.                        break;
  1473.            case DUNGEON:
  1474.                        mfs->fd_addr = (long) scr4; /* misc1.dat */
  1475.                        pxyarray[0] = 70; pxyarray[1] = 3; pxyarray[2]=192; pxyarray[3]=91; /* TL pic */
  1476.                        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy */
  1477.                        break;
  1478.            case PALACE:
  1479.                        mfs->fd_addr = (long) scr5; /* misc2.dat */
  1480.                        pxyarray[0] = 194; pxyarray[1] = 93; pxyarray[2]=316; pxyarray[3]=181; /* BR pic */
  1481.                        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy */
  1482.                        break;
  1483.            case TEMPLE:
  1484.                        mfs->fd_addr = (long) scr4; /* misc1.dat */
  1485.                        pxyarray[0] = 194; pxyarray[1] = 93; pxyarray[2]=316; pxyarray[3]=181; /* BR pic */
  1486.                        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy */
  1487.                        break;
  1488.            case DOOR:  mfs->fd_addr = (long) scr4; /* misc1.dat */
  1489.                        pxyarray[0] = 194; pxyarray[1] = 3; pxyarray[2]=316; pxyarray[3]=91; /* TR pic */
  1490.                        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy */
  1491.                        break;
  1492.            case WALL:  mfs->fd_addr = (long) scr2; /* estabs.dat */
  1493.                        pxyarray[0] = 194; pxyarray[1] = 3; pxyarray[2]=316; pxyarray[3]=91; /* TR pic */
  1494.                        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy */
  1495.                        break;
  1496.           }
  1497.  
  1498.       } /* end of facing an estab */
  1499.  
  1500.             /* ONE more condition, if we opened the gate leading to 
  1501.                the wizards tower an the dungeon entrance, we set 
  1502.                map[13][1].e = 164;                                  
  1503.                map[13][2].w = 163;
  1504.                so that we can pass through, the only problem is that 
  1505.                we need this info to be = to -9 which reps a gate!
  1506.                so test to see if these values ar NOT -9 and if they are not
  1507.                then display a pic of a gate thats open and set 
  1508.                facing = some neg # so that the case below will fall through.. */
  1509.        if( ((cell == 164 && dir == 'W') || (cell == 163 && dir =='E')) 
  1510.           && (map[13][1].e == 164 ) )  /* only need to check one */
  1511.        {
  1512.          mfs->fd_addr = (long) scr3; /* gate.dat */
  1513.          pxyarray[0] = 194; pxyarray[1] = 93; pxyarray[2]=316; pxyarray[3]=181; /* BR pic */
  1514.          vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy */       
  1515.          facing = -88;  /* set facing to a neg # */
  1516.        }    
  1517.  
  1518. if( facing > 0)       /* if not facing and estab(or door, or front wall) */
  1519.  {          
  1520.    pxyarray[4] = 195;   /* Reset dest starting coords. for the 6 regions... */
  1521.     pxyarray[6] = 214;
  1522.             
  1523.   switch(dir)
  1524.     {
  1525.      case 'N' : {
  1526.         /* vrocopy the 6 regions
  1527.          pxyarray[4-7] is the dest.
  1528.          pxyarray[4] & pxyarray[6] need to be inc by 20 
  1529.          after each vrocopy is called for a region( cause the regions 
  1530.          are 20 pixels long )
  1531.          pxyarray[5]& [7] are constant.
  1532.    
  1533.          */
  1534.    /**
  1535.       roomrec has an entry for each room
  1536.        1. to access that entry use the map[y][x].room variable
  1537.           as an index into roomrec[].<Filedx>
  1538.    **/
  1539.        /* region 1 */
  1540.        
  1541.        getcoord(roomrec[map[y][x].room].N.Field1,pxyarray ); /* returns source pxyarray */
  1542.        if(roomrec[map[y][x].room].N.Field1) /* that is, if !Empty ..then copy */
  1543.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1544.    
  1545.        /*region 2 */
  1546.        pxyarray[4] += 19;   /* dest */
  1547.        pxyarray[6] += 19;
  1548.        getcoord(roomrec[map[y][x].room].N.Field2,pxyarray  ); /* returns source pxyarray */
  1549.        if(roomrec[map[y][x].room].N.Field2) /* that is, if !Empty ..then copy */
  1550.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1551.    
  1552.         /*region 3 */
  1553.        pxyarray[4] += 19;   /* dest */
  1554.        pxyarray[6] += 19;
  1555.        getcoord(roomrec[map[y][x].room].N.Field3,pxyarray  ); /* returns source pxyarray */
  1556.        if(roomrec[map[y][x].room].N.Field3) /* that is, if !Empty ..then copy */
  1557.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1558.  
  1559.         /*region 4 */
  1560.        pxyarray[4] += 20;   /* dest */
  1561.        pxyarray[6] += 20;
  1562.        getcoord(roomrec[map[y][x].room].N.Field4,pxyarray  ); /* returns source pxyarray */
  1563.        if(roomrec[map[y][x].room].N.Field4) /* that is, if !Empty ..then copy */
  1564.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1565.        
  1566.         /*region 5 */
  1567.        pxyarray[4] += 20;   /* dest */
  1568.        pxyarray[6] += 20;
  1569.        getcoord(roomrec[map[y][x].room].N.Field5,pxyarray  ); /* returns source pxyarray */
  1570.        if(roomrec[map[y][x].room].N.Field5) /* that is, if !Empty ..then copy */
  1571.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1572.        
  1573.        /*region 6 */
  1574.        pxyarray[4] += 20;   /* dest */
  1575.        pxyarray[6] += 20;
  1576.        getcoord(roomrec[map[y][x].room].N.Field6,pxyarray  ); /* returns source pxyarray */
  1577.        if(roomrec[map[y][x].room].N.Field6) /* that is, if !Empty ..then copy */
  1578.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1579.            break;
  1580.      }   
  1581.     
  1582.      case 'S' : {
  1583.             /* region 1 */
  1584.       
  1585.        getcoord(roomrec[map[y][x].room].S.Field1,pxyarray  ); /* returns source pxyarray */
  1586.        if(roomrec[map[y][x].room].S.Field1) /* that is, if !Empty ..then copy */
  1587.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1588.  
  1589.        /*region 2 */
  1590.        pxyarray[4] += 19;   /* dest */
  1591.        pxyarray[6] += 19;
  1592.        getcoord(roomrec[map[y][x].room].S.Field2,pxyarray  ); /* returns source pxyarray */
  1593.        if(roomrec[map[y][x].room].S.Field2) /* that is, if !Empty ..then copy */
  1594.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1595.  
  1596.         /*region 3 */
  1597.        pxyarray[4] += 19;   /* dest */
  1598.        pxyarray[6] += 19;
  1599.        getcoord(roomrec[map[y][x].room].S.Field3,pxyarray  ); /* returns source pxyarray */
  1600.        if(roomrec[map[y][x].room].S.Field3) /* that is, if !Empty ..then copy */
  1601.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1602.  
  1603.         /*region 4 */
  1604.        pxyarray[4] += 20;   /* dest */
  1605.        pxyarray[6] += 20;
  1606.        getcoord(roomrec[map[y][x].room].S.Field4,pxyarray  ); /* returns source pxyarray */
  1607.        if(roomrec[map[y][x].room].S.Field4) /* that is, if !Empty ..then copy */
  1608.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1609.        
  1610.         /*region 5 */
  1611.        pxyarray[4] += 20;   /* dest */
  1612.        pxyarray[6] += 20;
  1613.        getcoord(roomrec[map[y][x].room].S.Field5,pxyarray  ); /* returns source pxyarray */
  1614.        if(roomrec[map[y][x].room].S.Field5) /* that is, if !Empty ..then copy */
  1615.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1616.        
  1617.        /*region 6 */
  1618.        pxyarray[4] += 20;   /* dest */
  1619.        pxyarray[6] += 20;
  1620.        getcoord(roomrec[map[y][x].room].S.Field6,pxyarray  ); /* returns source pxyarray */
  1621.        if(roomrec[map[y][x].room].S.Field6) /* that is, if !Empty ..then copy */
  1622.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1623.  
  1624.           break;
  1625.                 }   
  1626.      case 'E' : {
  1627.              /* region 1 */
  1628.       
  1629.        getcoord(roomrec[map[y][x].room].E.Field1,pxyarray  ); /* returns source pxyarray */
  1630.        if(roomrec[map[y][x].room].E.Field1) /* that is, if !Empty ..then copy */
  1631.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1632.  
  1633.        /*region 2 */
  1634.        pxyarray[4] += 19;   /* dest */
  1635.        pxyarray[6] += 19;
  1636.        getcoord(roomrec[map[y][x].room].E.Field2,pxyarray  ); /* returns source pxyarray */
  1637.        if(roomrec[map[y][x].room].E.Field2) /* that is, if !Empty ..then copy */
  1638.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1639.  
  1640.         /*region 3 */
  1641.        pxyarray[4] += 19;   /* dest */
  1642.        pxyarray[6] += 19;
  1643.        getcoord(roomrec[map[y][x].room].E.Field3,pxyarray  ); /* returns source pxyarray */
  1644.        if(roomrec[map[y][x].room].E.Field3) /* that is, if !Empty ..then copy */
  1645.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1646.  
  1647.         /*region 4 */
  1648.        pxyarray[4] += 20;   /* dest */
  1649.        pxyarray[6] += 20;
  1650.        getcoord(roomrec[map[y][x].room].E.Field4,pxyarray  ); /* returns source pxyarray */
  1651.        if(roomrec[map[y][x].room].E.Field4) /* that is, if !Empty ..then copy */
  1652.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1653.        
  1654.         /*region 5 */
  1655.        pxyarray[4] += 20;   /* dest */
  1656.        pxyarray[6] += 20;
  1657.        getcoord(roomrec[map[y][x].room].E.Field5,pxyarray  ); /* returns source pxyarray */
  1658.        if(roomrec[map[y][x].room].E.Field5) /* that is, if !Empty ..then copy */
  1659.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1660.        
  1661.        /*region 6 */
  1662.        pxyarray[4] += 20;   /* dest */
  1663.        pxyarray[6] += 20;
  1664.        getcoord(roomrec[map[y][x].room].E.Field6,pxyarray  ); /* returns source pxyarray */
  1665.        if(roomrec[map[y][x].room].E.Field6) /* that is, if !Empty ..then copy */
  1666.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1667.  
  1668.            break;
  1669.                 }      
  1670.      case 'W' : 
  1671.       {
  1672.        /* region 1 */
  1673.       
  1674.        getcoord(roomrec[map[y][x].room].W.Field1,pxyarray  ); /* returns source pxyarray */
  1675.        if(roomrec[map[y][x].room].W.Field1) /* that is, if !Empty ..then copy */
  1676.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1677.  
  1678.        /*region 2 */
  1679.        pxyarray[4] += 19;   /* dest */
  1680.        pxyarray[6] += 19;
  1681.        getcoord(roomrec[map[y][x].room].W.Field2,pxyarray  ); /* returns source pxyarray */
  1682.        if(roomrec[map[y][x].room].W.Field2) /* that is, if !Empty ..then copy */
  1683.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1684.  
  1685.         /*region 3 */
  1686.        pxyarray[4] += 19;   /* dest */
  1687.        pxyarray[6] += 19;
  1688.        getcoord(roomrec[map[y][x].room].W.Field3,pxyarray  ); /* returns source pxyarray */
  1689.        if(roomrec[map[y][x].room].W.Field3) /* that is, if !Empty ..then copy */
  1690.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1691.  
  1692.         /*region 4 */
  1693.        pxyarray[4] += 20;   /* dest */
  1694.        pxyarray[6] += 20;
  1695.        getcoord(roomrec[map[y][x].room].W.Field4,pxyarray  ); /* returns source pxyarray */
  1696.        if(roomrec[map[y][x].room].W.Field4) /* that is, if !Empty ..then copy */
  1697.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1698.        
  1699.         /*region 5 */
  1700.        pxyarray[4] += 20;   /* dest */
  1701.        pxyarray[6] += 20;
  1702.        getcoord(roomrec[map[y][x].room].W.Field5,pxyarray  ); /* returns source pxyarray */
  1703.        if(roomrec[map[y][x].room].W.Field5) /* that is, if !Empty ..then copy */
  1704.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1705.        
  1706.        /*region 6 */
  1707.        pxyarray[4] += 20;   /* dest */
  1708.        pxyarray[6] += 20;
  1709.        getcoord(roomrec[map[y][x].room].W.Field6,pxyarray  ); /* returns source pxyarray */
  1710.        if(roomrec[map[y][x].room].W.Field6) /* that is, if !Empty ..then copy */
  1711.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy wholescreens */
  1712.  
  1713.             break;
  1714.        }
  1715.  
  1716.    }  /*end of switch*/  
  1717.   } /* end of facing a wall */
  1718. }
  1719.  
  1720. /***/
  1721. check_for_door()
  1722. {
  1723.  int dn,ds,de,dw;
  1724.  
  1725.  dn = map[y][x].n;
  1726.  ds = map[y][x].s;
  1727.  de = map[y][x].e;
  1728.  dw = map[y][x].w;
  1729.  
  1730. if(dn < 0 || ds < 0 || de < 0 || dw < 0 )
  1731.  v_gtext(handle,6,83,"   A door is near.     ");
  1732.  
  1733. }
  1734.  
  1735.